package genericity.run;

import genericity.pojo.Apple;
import genericity.pojo.Fruit;
import genericity.pojo.Plate;

/**
 * 水果容器测试类
 * @author songyafei
 */
public class PlateTest1 {

    public static void main(String[] args) {
        Plate<? extends Fruit> plate = new Plate<Apple>(new Apple());

        //不能存放任何元素
//        plate.setItem(new Fruit()); //error
//        plate.setItem(new Apple()); //error

        /**
         * 取出来的东西只能放在它的基类和他本身
         */
        Fruit item = plate.getItem();
        Object ob = plate.getItem();
//        Apple  ap = plate.getItem(); error

    }
}
